M_NAME=math
DESTINATION := $(PROJECT_LIB)lib$(M_NAME).so

M_OUT = $(PROJECT_OUT)$(M_NAME)/

LIBS := # $(shell pkg-config --libs opencv4) #获得opencv扩展库。
INCLUDES := . $(PROJECT_INCLUDES) # $(shell pkg-config --cflags opencv4)  #获得opencv相关头文件路径
RM := rm -f
#C,CC或CPP文件的后缀
PS=c
# GNU Make的隐含变量定义
AR=ar
CPPFLAGS = -g -Wall -O3 #-march=i486
CPPFLAGS += $(addprefix -I,$(INCLUDES))
CPPFLAGS += -MMD

#以下部分无需修改
SOURCE := $(wildcard *.$(PS))
OBJS := $(patsubst %.$(PS),%.o,$(SOURCE))
OBJS_A = $(addprefix $(M_OUT),$(OBJS))
.PHONY : all clean 

all : dkdir $(DESTINATION)

dkdir:
	@mkdir -p $(M_OUT)
	
clean :
	

%.o:%.c
	gcc -c -g -Wall $(CPPFLAGS) $< -o $(M_OUT)$@ -MD -MF $(M_OUT)$*.d -MP  

$(DESTINATION) : $(OBJS)
	$(CC) -shared -fPIC -o $(DESTINATION) $(OBJS_A) $(addprefix -l,$(LIBS))
#	$(AR) -rcs $(DESTINATION) $(OBJS) $(addprefix -l,$(LIBS))
